<script setup lang="ts">
//给emits标注类型
//1.定义Emits类型
type ListItem = {
    id: number,
    name: string
}
type Emits = {
    (e: 'get-msg', msg: string): void
    (e: 'get-list', list:ListItem[]): void
}
//2.给defineEmits传递泛型参数
const emit = defineEmits<Emits>()
const clickHandler = () => {
    //触发自定义事件
    emit('get-msg', 'i am son')
    emit('get-list', [{
        id: 1001,
        name: '冬季棉袜'
    }])
}
//问题：给Son组件再触发一个事件'get-list'，传递参数类型为下面所示的数据类型
/* [{
    id: 1001,
    name: '冬季棉袜'
}] */

</script>
<template>
    <div>
        <button @click="clickHandler">button</button>
    </div>
</template>

<style lang="scss" scoped>

</style>